<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>病案错误报告处理</title>
</head>
<body>
      <div class="easyui-layout" data-options="fit:true,border:0"> 
         <div data-options="region:'north',split:true,height:'75%'" class="Cancel_borderTL"> 
			<div id="toolbar_MedErrorsb">
			   <span class="paddingTBL">
			    	<select id="Errorsb_rqlx" class="easyui-combobox" data-options="editable:false,width:100,height:24">
			        	<option value="1" selected="selected">出院日期</option>
			        	<option value="2">上报日期</option>
			        </select>&nbsp;
					<input type="text" class="easyui-datebox" id="Errorsb_date1" data-options="width:115,height:24"/>
					<label>&nbsp;至&nbsp;</label>
					<input type="text" class="easyui-datebox" id="Errorsb_date2" data-options="width:115,height:24"/>
			        
			        <label class="paddingL">错误类型&nbsp;</label>
					<select class="easyui-combobox" id="Errorsb_cwlx" data-options="width:120,height:24">
						<option value="0" selected="selected">全部</option>
			            <option value="1">图片分类错误</option>
			            <option value="2">病案页数错误</option>
			            <option value="3">病案拍摄模糊</option>
			            <option value="4">病案拍摄漏页</option>
			            <option value="5">图片角度错误</option>
				     </select>
				     <span style="padding-left:8px;"></span> 
				  </span> 
				    
				  <span class="paddingLB" style="width:275px;border:0px solid red"> 
					            是否处理&nbsp; 
						<select class="easyui-combobox" id="Errorsb_sfcl" data-options="width:100,height:24">
							<option value="0" selected="selected">全部</option>
				            <option value="1">已全部处理</option>
				            <option value="2">有未处理</option>
				            <option value="3">拒绝</option> 
					     </select>
					     
					     <label class="paddingL"></label>
						 <a href="#" class="easyui-linkbutton" onclick="queryAllArchiving()">查 询</a>
		          </span>
		   </div> 
		   <table id="MedErrorsbGrid"></table> 
		 </div>
		 
		 <div data-options="region:'south',height:'25%'"> 
		     <span class="paddingTBL"> 
				  <label>处理意见&nbsp;</label><p/>
				  <span style="vertical-align: middle;">
					  <textarea id="FCLYJ_Id"  style="resize:none;width:90%;min-width:620px;height:50px;"></textarea>
				  </span> 
				  <span class="paddingL"></span>
				  <a class="easyui-linkbutton" id="YCL_Id" onclick="YCL_Submit(1)">已处理</a>
				  <span class="paddingbtn"></span>
				  <a class="easyui-linkbutton" id="JuJ_Id" onclick="YCL_Submit(3)">拒绝</a>
		     </span>
		 </div>
	</div> 

<script type="text/javascript">
var ME_CurrentData;//保存当前点击行的数据

//查询数据
function queryAllArchiving(){  
	var rqlx = $("#Errorsb_rqlx").combobox("getValue");
	var date1 = $("#Errorsb_date1").datebox("getValue");
	var date2 = $("#Errorsb_date2").datebox("getValue"); 
	var cwlx = $("#Errorsb_cwlx").combobox("getValue");  //错误类型
	var sfcl = $("#Errorsb_sfcl").combobox("getValue"); //是否处理
	 
	$("#MedErrorsbGrid").datagrid({
		url:ctx + "/MedicalCheckManage/queryAllErrossb",
		queryParams:{
			"rqlx" : rqlx,
			"date1" : date1,
			"date2" : date2, 
			"cwlx" : cwlx,
			"sfcl" : sfcl 
		}
	});
}

//加载数据表格
$("#MedErrorsbGrid").datagrid({
	url:'',
	toolbar:"#toolbar_MedErrorsb",
	rownumbers : true,
	fitColumns:false,
	border : false,
	striped : true,
	fit : true,
	singleSelect: true,
	pagination : true,
	pageSize : 20,
	pageList : [ 20, 30,50 ],
	onClickRow : ME_onClickRow, //单击列
	columns:[[
	    {field:'FID',title:'Id',width:1,hidden:true },
	    {field:'FTPBH',title:'病案号',width:120,align:'center'},
		{field:'FSTATE',title:'处理状态',width:100,align:'center',
        	formatter : function(value,row,index){
        		//if(value == null || value == ""){}
        		if(value == "1" ){
        			return "已全部处理";
        		}else if(value == "2" ){
        			return "有未处理";
        		}else if(value == "3" ){
        			return "拒绝";
        		}  
        	}	
		},  
		{field:'FOPTYPE',title:'错误类型',width:100,align:'center',
			 formatter:function (value,row,index){ 
					if(value="1"){
						return "图片分类错误";
					}else if(value="2"){
						return "病案页数错误";
					}else if(value="3"){
						return "病案拍摄模糊"					
					}else if(value="4"){
						return "病案拍摄漏页"					
					}else if(value="5"){
						return "图片角度错误"					
					}
			}
		}, 
		{field:'FPAGECODE',title:'错误页码',width:80,align:'center'}, 
		{field:'FREASON',title:'错误说明',width:160,align:'center'},  
		{field:'FSBUSER',title:'报告人',width:80,align:'center' },  
		{field:'FSBDATE',title:'报告日期',width:100,align:'center' ,
		   formatter :function(value,row,index){
			  return new Date(value).format("yyyy-MM-dd"); 
		   }	
		}, 
		{field:'FBARCODE',title:'条码号',width:160,align:'center'}, 
		
		{field:'FNAME',title:'姓名',width:80,align:'center' },  
		{field:'FSEX',title:'性别',width:50,align:'center' }, 
		{field:'FAGE',title:'年龄',width:50,align:'center'}, 
		{field:'FCYDATE',title:'出院日期',width:100,align:'center', 
		   	formatter:function(value,row,index ){
			   return new Date(value).format("yyyy-MM-dd");
		    } 	
		}, 
		{field:'FCYDEPT',title:'出院科室',width:100,align:'center'}, 
		
		{field:'FFLFZBH',title:'分类分组编号',hidden:true},   
		{field:'FZYID',title:'住院ID',width:1,hidden:true}, 
		
		{field:'FCLUSER',title:'处理人',width:80,align:'center' },
		{field:'FCLDATE',title:'处理时间',width:100,align:'center',
		   	formatter:function(value,row,index ){
			   return new Date(value).format("yyyy-MM-dd");
		    } 
		},
		{field:'FCLYJ',title:'处理意见',width:160,align:'center' } 
	  ]] 
	});

//点击表格数据事件
function ME_onClickRow(index, row){
	ME_CurrentData = row; 
	$('#FCLYJ_Id').val(row.FCLYJ);//处理意见
 
	if (row.FSTATE == '1' || row.FSTATE == '3') {
		$('#YCL_Id,#JuJ_Id').linkbutton('disable'); 
	}else{
		$('#YCL_Id,#JuJ_Id').linkbutton('enable'); 
	} 
	
}


//提交处理事件
function YCL_Submit(types){  
	var fclyj=$("#FCLYJ_Id").val();//处理意见
	
	//执行审批通过操作
 	$.ajax({ 
 		url: "MedicalCheckManage/submitFstate",
 		type: 'post',
 		dataType: 'json',
 		async: false,
 		data: {
 			   FID: ME_CurrentData.FID,
 			   FSTATE:types,
 			   FCLYJ: fclyj
 	    },
 		success: function(data){
 			if (data) {
				$.messager.alert('提示','提交成功','info');
				$('#sPurposeData').datagrid('reload');
			}else{
				$.messager.alert('提示','提交失败','info');
			}
 		}
 	}); 
} 

</script>  
</body>
</html>